<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>

<script>
  function dou(n) {
    if (n === 2) {
      return 1 / 2;
    }
    return 1 / n + dou(n - 2);
  }
  console.log(dou(10));
</script>
